package de.zinulla.moviethek;

import android.os.Bundle;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;

import de.zinulla.moviethek.fragments.CoverViewFragment;

public class CoverViewActivity extends SherlockFragmentActivity {

	long searchId;
	private CoverViewFragment coverFragment;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// Need to check if Activity has been switched to landscape mode
		// If yes, finished and go back to the start Activity
//		if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
//
//			return;
//		}
// 		Show the new fragment (full screen)
//		DetailFragment details = DetailFragment.newInstance(searchId);
		coverFragment = (CoverViewFragment) getSupportFragmentManager().findFragmentById(android.R.id.content);
		if(coverFragment == null){
			CoverViewFragment coverFragment = new CoverViewFragment();
			coverFragment = new CoverViewFragment();
			getSupportFragmentManager().beginTransaction().add(android.R.id.content, coverFragment).commit();
		} else {
			return;
		}

	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
//		SharedPreferences settings = this.getSharedPreferences(MyMovieConstants.MOVIE_SP, 0);
//		long id = settings.getLong(MyMovieConstants.MOVIE_ID, 0);
//		// Handle item selection
//		if("Delete".equals(item.getTitle())){
//			deleteMovie(id);
//		} else {
//			return super.onOptionsItemSelected(item);
//		}

		return true;
	}
}
